//有假币
import java.util.*;
public class Main {
	    public static void main(String args[]) {
	        Scanner scan = new Scanner(System.in);
	        int n = scan.nextInt();
	        while (true) {
	            if (n == 0) {
	                break;
	            }
	            int count = 0;
	            while (n != 1) {   //每次进行称重，称到只有一张硬币为止
	                if (n % 3 == 0) {  //将他们分散三堆，取出最轻的进行下一轮称重
	                    n = n / 3;
	                    count++;
	                } else {     
	                    n = n / 3 + 1;
	                    count++;
	                }
	            }
	            System.out.println(count);
	            n = scan.nextInt();
	        }
	    }
	 
	}
